ScrapBubble for TamperMonkey
takker.icon用の設定
code:script.js
// ==UserScript==
// @name ScrapBubble
// @version 0.3.1
// @description n hop先のテキストを表示する
// @author takker
// @license MIT
// @unwrap
// @copyright Copyright (c) 2021 takker
// ==/UserScript==
window.addEventListener("load", async () => {
await new Promise(resolve => {
let timer = null;
timer = setInterval(() => {
if (!document.getElementById('editor')) return;
clearInterval(timer);
resolve();
}, 1000);
});
// 念の為1秒くらい待っとく
await new Promise((resolve) => setTimeout(() => resolve(), 1000));
const res = await fetch('/api/projects');
const { projects } = await res.json();
if (projects.map(({ name }) => name).includes(scrapbox.Project.name)) {
console.info(You belong to "/${scrapbox.Project.name}".);
return;
}
console.info(You don't belong to "/${scrapbox.Project.name}". Loading ScrapBubble via TamperMonkey...);
const code = "/api/code/takker-dist/ScrapBubble-min/app.js"
const { mount } = await import(code);
switch (scrapbox.Project.name) {
case "hub":
case "villagepump":
case "verbalizing-community":
whiteList.push("villagepump", "hub", "verbalizing-community");
break;
case "programming-notes":
case "customize":
case "scrapboxlab":
whiteList.push("programming-notes", "customize", "scrapboxlab");
break;
case "sta":
whiteList.push("sta-taskmanagement");
break;
case "sta-taskmanagement":
case "taskmanagement":
whiteList.push("sta-taskmanagement", "taskmanagement");
break;
}
mount({ whiteList });
}, { once: true });